package com.shop.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * OrderDetail entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "order_detail", catalog = "myshop")
public class OrderDetail implements java.io.Serializable {

	// Fields

	private Integer eodId;
	private Product product;
	private Order order;
	private Integer eodQuantity;
	private Float eodCost;

	// Constructors

	/** default constructor */
	public OrderDetail() {
	}

	/** full constructor */
	public OrderDetail(Product product, Order order, Integer eodQuantity,
			Float eodCost) {
		this.product = product;
		this.order = order;
		this.eodQuantity = eodQuantity;
		this.eodCost = eodCost;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "eod_id", unique = true, nullable = false)
	public Integer getEodId() {
		return this.eodId;
	}

	public void setEodId(Integer eodId) {
		this.eodId = eodId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ep_id", nullable = false)
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "eo_id", nullable = false)
	public Order getOrder() {
		return this.order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	@Column(name = "eod_quantity", nullable = false)
	public Integer getEodQuantity() {
		return this.eodQuantity;
	}

	public void setEodQuantity(Integer eodQuantity) {
		this.eodQuantity = eodQuantity;
	}

	@Column(name = "eod_cost", nullable = false, precision = 12, scale = 0)
	public Float getEodCost() {
		return this.eodCost;
	}

	public void setEodCost(Float eodCost) {
		this.eodCost = eodCost;
	}

}